package com.cjk.ssm.service;

import com.cjk.ssm.entity.Department;
import com.cjk.ssm.exp.MyNoDataException;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 部门 -- 服务层
 */
public interface DepartmentService {
    /**
     * 添加一条记录
     * 只添加部门名称，id自动生成
     *
     * @param department
     * @return
     */
    void add(Department department) throws Exception;

    /**
     * 根据id，删除一条记录
     *
     * @param id
     * @return
     */
    void del(Integer id) throws Exception;

    /**
     * 删除多条记录
     *
     * @param ids
     * @return
     */
    void delOneOrMore(@Param("ids") Integer[] ids) throws Exception;

    /**
     * 修改操作
     *
     * @param department
     * @return
     */
    void upd(Department department) throws Exception;

    /**
     * 查找所有
     *
     * @return
     */
    List<Department> findAll() throws Exception;

    /**
     * 查找所有, 带有分页信息
     *
     * @param pageNume
     * @param pageSize
     * @return
     */
    PageInfo<Department> findAllPage(Integer pageNume, Integer pageSize) throws Exception;

    /**
     * 查找所有, 带有分页信息
     *
     * @return
     * @throws Exception
     */
    PageInfo<Department> findAllPage() throws Exception;

    /**
     * 根据id查找部门信息
     *
     * @param
     * @return
     */
    Department findById(Integer id) throws Exception;

    /**
     * 根据名称模糊查找
     *
     * @param name
     * @return
     */
    List<Department> findByDeptNameLike(String name) throws Exception;

    /**
     * 根据名称模糊查找
     * 分页信息
     *
     * @param name
     * @return
     * @throws Exception
     */
    PageInfo<Department> findByDeptNameLikePage(String name) throws Exception;

    /**
     * 根据名称模糊查找
     * 分页信息
     *
     * @param name
     * @param pageNume
     * @param pageSize
     * @return
     * @throws Exception
     */
    PageInfo<Department> findByDeptNameLikePage(String name, Integer pageNume, Integer pageSize) throws Exception;

    /**
     * 综合查找
     *
     * @param department
     * @return
     */
    List<Department> findByCondition(Department department) throws Exception;

    PageInfo<Department> findByConditionPage(Department department, Integer pageNum, Integer pageSize) throws Exception;

    PageInfo<Department> findByConditionPage(Department department) throws Exception;
}
